package com.learn;

import com.learn.annotate.HelloAnnotation;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.reflect.Method;


public class TestHelloAnnotation {
    public static void main(String[] args) {
        new TestHelloAnnotation();
        output();
        try {
            Method method = TestHelloAnnotation.class.getMethod("output",new Class[]{});
            HelloAnnotation helloAnnotation = method.getAnnotation(HelloAnnotation.class);
            System.out.println(helloAnnotation.hello());
            System.out.println(helloAnnotation.lamp());

        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        }

    }

    @HelloAnnotation(hello = "shanghai",array = {1,2,3},lamp = RetentionPolicy.RUNTIME)
    public static void output() {
        System.out.println("output something!~");
    }
}
